home *** CD-ROM | disk | FTP | other *** search
Wrap
package iCat; import com.netobjects.nfc.api.ApplicationComp; import com.netobjects.nfc.api.DFile; import com.netobjects.nfc.api.DFusion; import com.netobjects.nfc.api.DMessageBox; import com.netobjects.nfc.api.DNode; import com.netobjects.nfc.api.DRect; import com.netobjects.nfc.api.DSite; import com.netobjects.nfc.api.DSiteView; import java.awt.FileDialog; import java.awt.Frame; public class iCatECommerceDemo extends ApplicationComp { // $FF: renamed from: OK int private static final int field_0 = 1; private static final int CANCEL = 0; private int m_user_action; private int m_numChildren; private String codebase; private boolean success = false; private DNode m_tempNode; private DNode m_homeNode; private DRect m_rect; private FileDialog m_dialog; private Frame m_frame; private DMessageBox m_messageBox = new DMessageBox(); public void onEnable(DSiteView var1) { try { this.codebase = ((ApplicationComp)this).getNFXCodeBase(); this.m_tempNode = new DNode(); this.m_homeNode = this.m_tempNode.getHomeNode(); this.m_numChildren = this.m_homeNode.getNumberOfChildren(); if (this.m_numChildren != 0) { this.m_messageBox.Warning("Error: You must start with a new, blank site."); return; } if (this.m_homeNode != null) { this.success = var1.importNFTemplate(this.codebase + "iCatDemo\\iCat.nft", this.m_homeNode); if (!this.success) { this.m_user_action = this.m_messageBox.Alert("Can't locate the iCat.nft template.\r\n Select 'OK' to locate the template manually."); while(this.m_user_action == 1) { this.m_frame = new Frame(); this.m_frame.setBounds(150, 150, 0, 0); this.m_dialog = new FileDialog(this.m_frame); this.m_dialog.setMode(0); this.m_dialog.show(); String var2 = this.m_dialog.getDirectory(); String var3 = this.m_dialog.getFile(); if (var3 != null) { if (var3.compareTo("iCat.nft") != 0) { this.m_user_action = this.m_messageBox.Alert("Error: This is not the iCat.nft template. /r/n Please select the iCat.nft template."); } else { this.m_user_action = 0; String var4 = var2 + var3; this.success = var1.importNFTemplate(var4, this.m_homeNode); if (!this.success) { this.m_messageBox.Warning("Error importing template."); } else { this.insertGIF(this.m_homeNode); this.writeiCatFile(); } } } else { this.m_user_action = 0; } } return; } this.insertGIF(this.m_homeNode); this.writeiCatFile(); return; } } catch (Throwable var5) { this.m_messageBox.Warning("Error: " + var5); } } private void insertGIF(DNode var1) { try { this.m_rect = new DRect(); this.m_rect.setTop(50); this.m_rect.setLeft(50); this.m_rect.setBottom(452); this.m_rect.setRight(418); var1.insertPictureObject2Page(this.codebase + "iCatDemo\\iCatMade.gif", this.m_rect); this.m_messageBox.Warning("The iCat-NetObjects Integration Technical Note contains important information that you\r\nshould read before working with the sample Commerce Cart. Click OK to continue."); DFusion var2 = new DFusion(); var2.OpenDefaultBrowser(false, "http://www.icat.com/ico/netobjects4.pdf", ""); var1.setNodeName("iCat Demo"); } catch (Throwable var3) { this.m_messageBox.Warning("Error: " + var3); } } private void writeiCatFile() { String var1 = "http://www4.icat.com/store/democart"; DSite var2 = new DSite(); String var3 = var2.getName(); DFile var4 = new DFile(); if (var4.Open(this.codebase + "\\iCatInfo\\" + var3 + ".txt", 4097)) { var4.Seek(0, 0); var4.WriteString(var1, -1); var4.Close(); } else { DMessageBox var5 = new DMessageBox(); var5.Warning("The file (" + this.codebase + "iCatInfo\\" + var3 + ".txt) could not be created.\r\n" + "Without this file the iCat components will not publish correctly.\r\n"); } } }